﻿using System;
using NDBGen.Descriptors.Tables.Tokens;
using NDBGen.Plugins.DataAccess;

namespace NDBGen.Plugins.Descriptors.Tables.Tokens
{
    [TableTokenCodeGenerator(typeof(DataContractTokenDescriptor))]
    public sealed class DataContractTableTokenCodeGenerator : DotNetTableTokenCodeGeneratorBase
    {
        protected override object[] GenerateCustomAttributes()
        {
            var camelCase =
                this.Descriptor.TableName.Substring(0, 1).ToLower() +
                this.Descriptor.TableName.ToPascalCase().Substring(1);

            return new Object[]
            {
                TableMetadataHelper.CustomAttributes.DataContractFormat.SetArgs(camelCase)
            };
        }   
    }
}